package com.foreigntrade.xiao.controller;

import com.foreigntrade.xiao.bean.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@Slf4j
@RestController
@RequestMapping("/comm")
public class CommController {

    @RequestMapping("/recordLog")
    public Result recordLog(HttpServletRequest request){
        try{
            String ip = request.getRemoteHost();
            String page = request.getParameter("page");

            log.info("访问的IP：{},页面：{}",ip,page);

            return new Result(true,"记录日志成功！");
        }catch (Exception e){
            log.error("",e);
        }

        return new Result(true,"记录日志失败！");
    }
}
